package com.tech.koufu.tools;

import java.util.HashMap;
import java.util.Map;

import com.android.volley.AuthFailureError;
import com.android.volley.DefaultRetryPolicy;
import com.android.volley.RetryPolicy;
import com.android.volley.Response.ErrorListener;
import com.android.volley.Response.Listener;
import com.android.volley.toolbox.StringRequest;

public class CookieStringRequest extends StringRequest {
	public CookieStringRequest(String url, Listener<String> listener,
			ErrorListener errorListener) {
		super(url, listener, errorListener);
	}

	public CookieStringRequest(int method, String url,
			Listener<String> listener, ErrorListener errorListener) {
		super(method, url, listener, errorListener);
	}

	public Map mHeaders = new HashMap(1);

	public void setHeader(String cookie) {
		mHeaders.put("Cookie", cookie);
//		mHeaders.put("User-Agent", "curl/7.37.1");
	}

	@Override
	public Map getHeaders() throws AuthFailureError {

		return mHeaders;
	}
	@Override
	public RetryPolicy getRetryPolicy() { 
		RetryPolicy retryPolicy = new DefaultRetryPolicy(Statics.SOCKET_TIMEOUT, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT);  
		return retryPolicy; 
//		return super.getRetryPolicy();
	}
}
